package part08_外观模式_家庭影院;

/**
 * @ClassName: HomeTheaterFacade
 * @Author: AllenSun
 * @Date: 2020/3/2 22:09
 */
public class HomeTheaterFacade {
    //定义各个子系统的对象
    private Light light;
    private DVDPlayer dvdPlayer;
    private Popcorn popcorn;
    private Projecter projecter;
    private Screen screen;
    private Stereo stereo;

    //在构造器里完成初始化
    public HomeTheaterFacade() {
        super();
        this.light = Light.getInstance();
        this.dvdPlayer = DVDPlayer.getInstance();
        this.popcorn = Popcorn.getInstance();
        this.projecter = Projecter.getInstance();
        this.screen = Screen.getInstance();
        this.stereo = Stereo.getInstance();
    }

    //下面的四个方法完成观看整个流程，每个方法都完成了一套操作，不用一个一个的去操作

    /**
     * @MethodName: ready
     * @Author: AllenSun
     * @Date: 2020/3/2 22:21
     */
    public void ready(){
        System.out.println("----------准备开始看电影----------");
        popcorn.on();
        screen.down();
        projecter.on();
        stereo.on();
        dvdPlayer.on();
        light.dim();
    }

    /**
     * @MethodName: play
     * @Author: AllenSun
     * @Date: 2020/3/2 22:21
     */
    public void play(){
        System.out.println("----------开始播放----------");
        dvdPlayer.play();
    }

    /**
     * @MethodName: pause
     * @Author: AllenSun
     * @Date: 2020/3/2 22:21
     */
    public void pause(){
        System.out.println("----------暂停拿爆米花----------");
        dvdPlayer.pause();
        popcorn.pop();
        popcorn.off();
    }

    public void redisplay(){
        System.out.println("----------继续播放----------");
        dvdPlayer.play();
    }

    /**
     * @MethodName: end
     * @Author: AllenSun
     * @Date: 2020/3/2 22:21
     */
    public void end(){
        System.out.println("----------电影结束----------");
        light.bright();
        dvdPlayer.off();
        stereo.off();
        projecter.off();
        screen.up();
        System.out.println("----------去睡觉----------");
    }

}
